﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hartley.BusinessLogic;
using Hartley.DTOs;
using Hartley.Entities;


namespace Hartley.ApplicationLogic
{
   public class AthleticAL
    {
        HcFacade hcFacade = new HcFacade();


        public string saveAthleticEvent(AthleticEventDTO athleticEventDTO)
        {
            try
            {

               return hcFacade.saveAthleticEvent(athleticEventDTO);
            }
            catch(Exception e)
            {
                throw;
            }
        }


        public void saveAthleticData(AthleticDataDTO athleticDataDTO)
        {
            hcFacade.saveAthleticData(athleticDataDTO);
        }


        public void SaveAthleticRecord(AthleticRecordDTO athleticRecordDTO)
        {
            hcFacade.SaveAthleticRecord(athleticRecordDTO);
        } 


        public List<AthleticEventDTO> GetAthleticEventById(Guid athleticEventId)
        {
            return hcFacade.GetAthleticEventById(athleticEventId);
        }




        public List<AthleticEventDTO> GetAthleticEvents()
        {
            return hcFacade.GetAthleticEvents();

        }

        public List<AthleticDataDTO> GetAllAthleticData()
        {
            return hcFacade.GetAllAthleticData();

        }

        public List<AthleticDataDTO> GetAllYrsOfAthleticData()
        {
            return hcFacade.GetAllYrsOfAthleticData();
        }

        public List<AthleticDataDTO> GetAllLevelsOfAthleticData()
        {
            return hcFacade.GetAllLevelsOfAthleticData();
        }



        public List<AthleticEventDTO> GetAllAgeDivisionAndEventCategoryByYear(int yr)
        {
            return hcFacade.GetAllAgeDivisionAndEventCategoryByYear(yr);
        }

        public List<AthleticEventDTO> GetAllAgeDivisionAndEventCategoryFromAthleticDataList(List<AthleticDataDTO> athleticData)
        {
            return hcFacade.GetAllAgeDivisionAndEventCategoryFromAthleticDataList(athleticData);
        }


        public List<Guid> GetAthleticIdByAgeDivisionAndEventCategory(string ageDivision, string eventCategory)
        {
            return hcFacade.GetAthleticIdByAgeDivisionAndEventCategory(ageDivision, eventCategory);
        }

        public List<AthleticDataDTO> GetAthleticDataByYearByLevelByAgeGruopByEvent(int year, string levelName, string ageDivision, string eventCategory)
        {
            return hcFacade.GetAthleticDataByYearByLevelByAgeGruopByEvent(year, levelName, ageDivision, eventCategory);
        }

        public List<AthleticDataDTO> GetAthleticDataByYearByLevelByAgeGruopByEventByPlace(int year, string levelName, string ageDivision, string eventCategory, string place)
        {
            return hcFacade.GetAthleticDataByYearByLevelByAgeGruopByEvent(year, levelName, ageDivision, eventCategory).Where(b => b.Place == place).OrderBy(c => c.Place).ToList();
        }

        public List<AthleticDataDTO> GetAllAthleticDataOfStudent(Guid studentId)
        {
            return hcFacade.GetAllAthleticDataOfStudent(studentId);
        }

        //public bool isRelay(Guid athleticEventId)
        //{
        //    //return hcFacade.isRelay(athleticEventId);
        //}
   }

}
